package com.future.controller;

import java.util.Date;

import com.future.common.annotation.ControllerMapping;
import com.future.common.annotation.NoNeedLogin;
import com.future.common.base.BaseController;
import com.future.common.utils.IDUtil;
import com.future.dao.XjyDao;
import com.future.model.Qiandao;
import com.future.model.Xjy;
import com.jfinal.aop.Inject;

@ControllerMapping("/qd")
public class QianDaoController extends BaseController{
	@Inject
	private Qiandao qiandao;
	@Inject
	private XjyDao xjyDao;
	public void queryQiandao(){
		renderResult("qiandaolist", this.qiandao.findAll());
	}
	
	@NoNeedLogin
	public void qiandao(String xjryid, String qddd){
		Xjy xjr = xjyDao.findById(xjryid);
		Qiandao qiandao = new Qiandao();
		qiandao.setQdid(IDUtil.getId());
		qiandao.setQdsj(new Date());
		qiandao.setXjrid(xjryid);
		qiandao.setXjrname(xjr.getName());
		qiandao.setQddd(qddd);
		qiandao.save();
		renderSuccess();
		
		
	}
}
